package com.jumi.microservice.controller.usercash.api;

import com.jumi.microservice.common.base.BaseController;
import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.common.page.TableDataInfo;
import com.jumi.microservice.dto.userWallet.WalletInOrOutListRequest;
import com.jumi.microservice.dto.userWallet.WalletInOrOutListResponse;
import com.jumi.microservice.dto.wallet.api.WalletUserRequest;
import com.jumi.microservice.service.usercash.admin.AdminCpsWalletInOrOutService;
import com.jumi.microservice.service.usercash.api.CpsWalletInOrOutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;


/**
 * @author scw
 * @since 2020-07-21
 */
@Api(tags = {"C端--用户钱包相关接口"})
@RestController
@RequestMapping("/api/cps/userWallet")
public class CpsUserWalletController extends BaseController {
    @Resource
    CpsWalletInOrOutService cpsWalletInOrOutService;
    @Resource
    AdminCpsWalletInOrOutService adminCpsWalletInOrOutService;

    @PostMapping
    @ApiOperation("C端提现金额明细")
    public TableDataInfo<List<WalletInOrOutListResponse>> getWalletInOrOutList(WalletInOrOutListRequest request) {
        Integer uid = getApiUserId();
        request.setUserId(uid.longValue());
        return cpsWalletInOrOutService.getWalletInOrOutList(request);
    }

    @PostMapping("/waitCash")
    @ApiOperation("用户可提现金额")
    public ResponseResult<BigDecimal> waitCash() {
        Long uid = getApiUserId().longValue();
        return success(adminCpsWalletInOrOutService.waitCash(uid));
    }


}

